﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MS.Data.API.Read.Command.Role;
using MS.Data.API.Read.DTO;
using MS.Data.ErrorCode;

namespace MS.Data.API.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MangRoleController : ControllerBase
    {
        private readonly IMediator mediator;

        public MangRoleController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        [HttpGet]
        public Task<APIResult<ApiPagging<RoleDTO>>> GetRole([FromQuery]GetRoleCommand request)
        {
            return mediator.Send(request);
        }
    }
}
